home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 / Programming Windows 95.iso / code / CHAP12 / SHEET.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-01  |  2.9 KB  |  89 lines

  1. /*-----------------------------------------
  2.    SHEET.C -- Property sheet page functions.
  3.                  (c) Paul Yao, 1996
  4.   -----------------------------------------*/
  5. #include <windows.h>
  6. #include <windowsx.h>
  7. #include <commctrl.h>
  8. #include "comcthlp.h"
  9. #include "property.h"
  10.  
  11. extern DWORD dwChildStyle ;
  12. extern DWORD dwChildExStyle ;
  13. extern DWORD dwSheetStyles ;
  14. extern char szAppName[] ;
  15. extern HINSTANCE hInst ;
  16. extern HICON hiconApp ;
  17.  
  18. //-------------------------------------------------------------------
  19. int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
  20.      {
  21.      switch (uMsg)
  22.           {
  23.           case PSCB_INITIALIZED :
  24.                // Process PSCB_INITIALIZED
  25.                break ;
  26.  
  27.           case PSCB_PRECREATE :
  28.                // Process PSCB_PRECREATE
  29.                break ;
  30.  
  31.           default :
  32.                // Unknown message
  33.                break ;
  34.           }
  35.  
  36.      return 0 ;
  37.      }
  38.  
  39. //-------------------------------------------------------------------
  40. BOOL CreatePropertySheet (HWND hwndParent)
  41.      {
  42.      PROPSHEETHEADER pshead ;
  43.      PROPSHEETPAGE   pspage[2] ;
  44.  
  45.      // Initialize property sheet HEADER data
  46.      ZeroMemory (&pshead, sizeof (PROPSHEETHEADER)) ;
  47.      pshead.dwSize  = sizeof (PROPSHEETHEADER) ;
  48.      pshead.dwFlags = dwSheetStyles     |
  49.                       PSH_PROPSHEETPAGE |
  50.                       PSH_USECALLBACK   |
  51.                       PSH_USEHICON ;
  52.      pshead.hwndParent  = hwndParent ;
  53.      pshead.hInstance   = hInst ;
  54.      pshead.hIcon       = hiconApp ;
  55.      pshead.pszCaption  = "A Child Window" ;
  56.      pshead.nPages      = 2 ;
  57.      pshead.nStartPage  = 0 ;
  58.      pshead.ppsp        = pspage ;
  59.      pshead.pfnCallback = PropSheetProc ;
  60.  
  61.      // Zero out property PAGE data
  62.      ZeroMemory (&pspage, 2 * sizeof (PROPSHEETPAGE)) ;
  63.  
  64.      // PAGE 1 -- window style page
  65.      pspage[0].dwSize      = sizeof (PROPSHEETPAGE) ;
  66.      pspage[0].dwFlags     = PSP_USECALLBACK | PSP_USEICONID ;
  67.      pspage[0].hInstance   = hInst ;
  68.      pspage[0].pszTemplate = MAKEINTRESOURCE (IDD_STYLES) ;
  69.      pspage[0].pszIcon     = MAKEINTRESOURCE (IDI_PAGE1) ;
  70.      pspage[0].pfnDlgProc  = StyleDlgProc ;
  71.      pspage[0].lParam      = (LPARAM) &dwChildStyle ;
  72.      pspage[0].pfnCallback = StylePageProc ;
  73.  
  74.      // PAGE 2 -- extended window style page
  75.      pspage[1].dwSize      = sizeof (PROPSHEETPAGE) ;
  76.      pspage[1].dwFlags     = PSP_USECALLBACK | PSP_USEICONID | 
  77.                              PSP_HASHELP ;
  78.      pspage[1].hInstance   = hInst ;
  79.      pspage[1].pszTemplate = MAKEINTRESOURCE (IDD_EXSTYLES) ;
  80.      pspage[1].pszIcon     = MAKEINTRESOURCE (IDI_PAGE2) ;
  81.      pspage[1].pfnDlgProc  = ExStyleDlgProc ;
  82.      pspage[1].lParam      = (LPARAM) &dwChildExStyle ;
  83.      pspage[1].pfnCallback = ExStylePageProc ;
  84.  
  85.      // --------- Create & display property sheet --------- 
  86.  
  87.      return PropertySheet (&pshead) ;
  88.      }
  89.